package ppp.hhh.the.entity;

import lombok.Data;
import jakarta.validation.constraints.*;
import org.hibernate.validator.constraints.Length;
import ppp.hhh.the.annotation.MyCustomConstraint;

import java.io.Serializable;

@Data
public class User implements Serializable {
    // 主键
    private Long id;
    @NotBlank(message = "用户名不能为空")
    @Length(min = 2, max = 10, message = "用户名长度必须介于 2 和 10 之间")
    private String name;
    @NotNull(message = "年龄不能为空")
    @Min(value = 18, message = "最小为18岁")
    @Max(value = 60, message = "最大为60岁")
    private Integer age;
    @Email(message = "请输入邮箱")
    @NotBlank(message = "邮箱不能为空")
    private String email;
    @MyCustomConstraint
    private String answer;
}